#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
int n,m,k,T;

int arr[1000010] = {};
int pre[1000010] = {};
int sum[1000010] = {};
int dat[1000010] = {};

int find(int x) {
	if(pre[x] == x) return x;
	int num = find(pre[x]);
	pre[x] = num;
	return pre[x];
}

// 把y合并到x上
void join(int x,int y) {
	int fx = find(x);
	int fy = find(y);
	if(fx == fy) return;
	sum[fx] += sum[fy];
	dat[fx] += dat[fy];
	pre[fy] = fx;
}

signed main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin >> n >> m;
	for(int i = 1;i <= n; ++ i) cin >> arr[i],pre[i] = i,sum[i] = arr[i],dat[i] = 1;
	while(m--) {
		int op = 0;
		cin >> op;
		if(op == 1) {
			int l,r;
			cin >> l >> r;
			int root = find(l);
			while(r > l) {
				int rs = find(r);
				join(root,r);
				r = rs - 1;
			}
		}else {
			int ind = 0;
			cin >> ind;
			int fi = find(ind);
			cout << fixed << setprecision(10) << sum[fi] * 1.0 / dat[fi] * 1.0 << endl;
		}
	}
	return 0;
}